<?php
/**
 * ExtDataProxy class file
 *
 * @author TrueSoftware B.V. (The Netherlands)
 * @link http://www.ext4yii.com
 * @copyright Copyright 2007-2010 TrueSoftware B.V. all rights reserved.
 * @license http://www.ext4yii.com/license/
 *          EVALUATION VERSION - NOT FOR COMMERCIAL USE OR DISTRIBUTION.
 * @version 0.7.2
 */

abstract class ExtDataProxy extends ExtDataProxyBase
{
    /**
     * Gets the value of ExtJS restful property
     * @return Boolean 
     */
    public function getRestful()
    {
    	return $this->getConfig("restful");
    }

    /**
     * Sets the value of ExtJS restful property
     * @param Boolean $value 
     */
    public function setRestful($value)
    {
    	$this->setConfig("restful",$value);
    }

    /**
     * Gets the value of ExtJS controllerName property
     * @return String 
     */
    public function getControllerName()
    {
    	return $this->getConfig("controllername");
    }

    /**
     * Sets the value of ExtJS controllerName property
     * @param String $value 
     */
    public function setControllerName($value)
    {
    	$this->setConfig("controllername",$value);
    }

    /**
     * @description maps to the load function in Ext.data.DataProxy
     * @param sender String -
     * @param params Object -
     * @param reader Object -
     * @param callback Object -
     * @param scope Object -
     * @param arg Object - 
     */
    public static function load_OnAjax($params,$reader,$callback,$scope,$arg,$sender=null)
    {
    	ExtWidget::checkSetAjaxRequestValue('load(%s,%s,%s,%s,%s)',
    		array($params,$reader,$callback,$scope,$arg),
    			 $sender);
    }

    /**
     * @description maps to the request function in Ext.data.DataProxy
     * @param sender String -
     * @param action String -
     * @param rs Ext.data.Record/Ext.data.Record[]/null -
     * @param params Object -
     * @param reader Ext.data.DataReader -
     * @param callback Function -
     * @param scope Object -
     * @param options Object - 
     */
    public static function request_OnAjax($action,$rs,$params,$reader,$callback,$scope,$options,$sender=null)
    {
    	ExtWidget::checkSetAjaxRequestValue('request("%s",%s,%s,%s,%s,%s,%s)',
    		array(str_replace('"','\"',$action),$rs,$params,$reader,$callback,$scope,$options),
    			 $sender);
    }

    
    public function __construct()
    {
        parent::__construct();
        $this->configmap = array_merge($this->configmap,array(
            'controllername' => 'controllerName'
        ));

        $this->eventtable = array_merge($this->eventtable,array(
            'beforeload' => array('sender','params'),
            'beforewrite' => array('sender','action','rs','params'),
            'exception' => array('sender','type','action','options','response','arg'),
            'load' => array('sender','o','options'),
            'loadexception' => array('misc'),
            'write' => array('sender','action','data','response','rs','options')
        ));


        $this->proptags = array_merge($this->proptags,array(
            'apis' => true,
            'connection' => true
        ));
        $this->setXType(null);
        $this->setXClass('Ext.data.DataProxy');
    }    
}
?>